<script>
    function contract(houseId){
        
        $(function() {
            $( "#dialog:ui-dialog" ).dialog( "destroy" );
            $("#contract-box" ).dialog( {resizable: false,width: 450, modal: true});
            $("#contract-box").load("<?= $this->baseURI(); ?>marketing/team/contract/"+houseId);
        });
    }  
    function interaction(houseId){
        
        $(function() {
            $( "#dialog:ui-dialog" ).dialog( "destroy" );
            $("#interaction-box" ).dialog( {resizable: false,width: 450, modal: true });
            $("#interaction-box").load("<?= $this->baseURI(); ?>marketing/team/interaction/"+houseId);
        });
    }
</script>
<div class="dataBoxOver">
    <div class="dataInnRep">
        <div class="dataInnTop" id="team-listing">
            <div class="dataInnBottom">
                <div class="dataHeader">
                    <h4>Houses</h4>
                </div>
                <div class="clr"></div>
                <?php $this->addScriptPath('../application/views/scripts/'); ?>
                <?= $this->paginationControl($this->paginator, 'Sliding', 'paginator.phtml') ?>
                <div class="clr"></div>
                <table class="dataActions" width="100%" border="0" cellpadding="0" cellspacing="0" >
                    <tr>
                        <th>Cabinet</th>
                        <th>Switch</th>
                        <th>House</th>
                        <th>Address</th>
                        <th>Phone</th>
                        <th>Interaction</th>
                        <th>Contract</th>
                        <th>Status</th>                        
                    </tr>
                    <?php
                    foreach ($this->paginator as $item) {
                        $doc = $this->getContractDoc($item['id']);
                        ?>
                        <tr>
                            <td><?php echo $item['cabinet_name'] ?></td>
                            <td><?php echo $item['switch_name'] ?></td>
                            <td><?php echo $item['official_address']; ?></td>
                            <td><?php echo $item['address']; ?></td>
                            <td><?php echo '####'; ?></td>
                            <td><a href="javascript:void(0)" onclick="interaction('<?php echo $item['id']; ?>')"/>Interaction</a></td>
                            <td>
                                <a href="javascript:void(0)" onclick="contract('<?php echo $item['id']; ?>')"/><?php echo (!empty($doc) ? 'See' : 'Add') ?> Cont. Doc</a>
                            </td>
                            <td><?php echo $item['status']; ?></td>

                        </tr>
                    <?php } ?>
                </table>
            </div>
        </div>
    </div>
</div>
<div id="interaction-box" title="Interaction" ></div>
<div id="contract-box" title="Contract" ></div>